
/**
 * 实体类:描述一个员工
 */
public class User {
	// 私有属性
	private int id;
	private String name;
	private int age;
	
	// 私有属性通过public的get和set方法访问
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public int getAge() {
		return age;
	}
	
	public void setAge(int age) {
		if (age >= 1 && age <= 120) {
			this.age = age;
		}
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", name=" + name + ", age=" + age + "]";
	}

}
